<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script>
		
		arr = [5,9,6,4,2,7];

		for(var j = 0 ; j<arr.length-1; j++){
			for(var i = 0 ; i<arr.length-1; i++){
				if(arr[i]<arr[i+1]){
					temp = arr[i];
					arr[i] = arr[i+1];
					arr[i+1]= temp;
				}
			}
		}

		document.write(arr);

		// [5,6,9,4,2,7]

		// [5,6,4,9,2,7]

		// [5,6,4,2,9,7]

		// [5,6,4,2,7,9]

	</script>
</head>
<body>
	
</body>
</html>